package com.cwnu.onlinemall.service;

import com.cwnu.onlinemall.mapper.MallSalesrecordMapper;
import com.cwnu.onlinemall.pojo.MallSalesrecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SalesrecordServiceImpl implements SalesrecordService {
    @Autowired
   MallSalesrecordMapper mallSalesrecordMapper;

    @Override
    public List<MallSalesrecord> selectAll() {
        return mallSalesrecordMapper.selectByExample(null);
    }

    @Override
    public MallSalesrecord selectById(Integer id) {
        MallSalesrecord mallSalesrecord = mallSalesrecordMapper.selectByPrimaryKey(id);
        return mallSalesrecord;
    }

    @Override
    public Integer insert(MallSalesrecord mallSalesrecord) {
        int insertRow = mallSalesrecordMapper.insertSelective(mallSalesrecord);
        return insertRow;
    }

    @Override
    public Integer deleteById(Integer id) {
        return mallSalesrecordMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Integer updateById(MallSalesrecord mallSalesrecord) {
        return mallSalesrecordMapper.updateByPrimaryKeySelective(mallSalesrecord);
    }
}
